package in.muton.edushare.pages.univ;

import in.muton.edushare.pages.common.PollsStatsPanel;
import in.muton.edushare.poll.panels.PollList;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.CSSPackageResource;
import org.apache.wicket.markup.html.basic.Label;

import com.edushare.common.constants.ApplicationConstants;
import com.edushare.common.dao.PollStatsDAO;

public class UnivPoll extends UnivBase {

	public UnivPoll(PageParameters params) {
		super(params);
		add(CSSPackageResource
				.getHeaderContribution(PollList.class, "Poll.css"));

		add(new Label("heading", "Polls and Feedback"));
		PollStatsDAO ps = new PollStatsDAO(getSessionORMInterface());
		add(new PollsStatsPanel("statsFrag", ps.getTotalPolls(getModel()
				.getObject()), ps.getOpenPolls(getModel().getObject()), ps
				.getClosedPolls(getModel().getObject()), ps
				.getDraftPolls(getModel().getObject())));
		add(new PollList("activePanel", getModel().getObject(), this));

	}

	@Override
	public String getActivePage(PageParameters p) {
		return "UnivPoll";
	}

	@Override
	public String getPageTitle() {
		return getLoggedInUser().getCompleteUserName() + " | "
				+ getModel().getObject().getUniversityName() + " | Polls | "
				+ ApplicationConstants.APPLICATION_NAME;
	}

	private boolean newPoll = false;
}
